
    var exec = cordova.require('cordova/exec'); // eslint-disable-line no-undef
    var utils = require('cordova/utils');
    var PositionError = require('./PositionError');
    var pluginToNativeWatchMap = {};
    module.exports = {
        setDebug:function(success,error,args){
             exec(success, error, 'Geolocation', 'setDebug', [args]);
        },    
        getStoreLocations:function(success,error,args){
            var win = function () {
                exec(success, error, 'Geolocation', 'getStoreLocations', args);
            };
            var fail = function () {
                if (error) {
                    error(new PositionError(PositionError.PERMISSION_DENIED, 'Illegal Access'));
                }
            };
            exec(win, fail, 'Geolocation', 'getPermission', []);
        },
        stopService:function(success, error, args) {
            var win = function () {
                exec(success, error, 'Geolocation', 'stopService', args);
            };
            var fail = function () {
                if (error) {
                    error(new PositionError(PositionError.PERMISSION_DENIED, 'Illegal Access'));
                }
            };
            exec(win, fail, 'Geolocation', 'getPermission', []);
        },
        startService:function(success, error, args) {
            var win = function () {
                exec(success, error, 'Geolocation', 'startService', args);
            };
            var fail = function () {
                if (error) {
                    error(new PositionError(PositionError.PERMISSION_DENIED, 'Illegal Access'));
                }
            };
            exec(win, fail, 'Geolocation', 'getPermission', []);
        },
        stopLocation: function (success, error, args) {
          var win = function () {
                exec(success, error, 'Geolocation', 'stopLocation', args);
            };
            var fail = function () {
                if (error) {
                    error(new PositionError(PositionError.PERMISSION_DENIED, 'Illegal Access'));
                }
            };
            exec(win, fail, 'Geolocation', 'getPermission', []);
        },
        startLocation: function (success, error, args) {
          var win = function () {
                    exec(success, error, 'Geolocation', 'startLocation', args);
                };
                var fail = function () {
                    if (error) {
                        error(new PositionError(PositionError.PERMISSION_DENIED, 'Illegal Access'));
                    }
                };
                exec(win, fail, 'Geolocation', 'getPermission', []);
        },
        getCurrentPosition: function (success, error, args) {
            var win = function () {
                exec(success, error, 'Geolocation', 'getCurrentLoaction', args);
            };
            var fail = function () {
                if (error) {
                    error(new PositionError(PositionError.PERMISSION_DENIED, 'Illegal Access'));
                }
            };
            exec(win, fail, 'Geolocation', 'getPermission', []);
        },
    };
